import java.util.Scanner;

public class Demo6 {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		System.out.println("输入一个四位的整数：");
		while (!input.hasNextInt()) {
			String str = input.next();
			System.err.println("输入为" + str + "不是四位整数：");
		}
		int num = input.nextInt();
		if (num < 1000 || num > 10000) {
			System.err.println("请输入四位整数：");
		}
		int gw = (num % 10 + 5) % 10;
		int sw = (num / 10 % 10 + 5) % 10;
		int bw = (num / 100 % 10 + 5) % 10;
		int qw = (num / 1000 + 5) % 10;

		System.out.println(gw * 1000 + sw * 100 + bw * 10 + qw);

	}
}
